using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Data_SpriteInfo_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Data.SpriteInfo);

            field = type.GetField("Name", flag);
            app.RegisterCLRFieldGetter(field, get_Name_0);
            app.RegisterCLRFieldSetter(field, set_Name_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_Name_0, AssignFromStack_Name_0);
            field = type.GetField("rect", flag);
            app.RegisterCLRFieldGetter(field, get_rect_1);
            app.RegisterCLRFieldSetter(field, set_rect_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_rect_1, AssignFromStack_rect_1);
            field = type.GetField("pivot", flag);
            app.RegisterCLRFieldGetter(field, get_pivot_2);
            app.RegisterCLRFieldSetter(field, set_pivot_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_pivot_2, AssignFromStack_pivot_2);
            field = type.GetField("uv", flag);
            app.RegisterCLRFieldGetter(field, get_uv_3);
            app.RegisterCLRFieldSetter(field, set_uv_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_uv_3, AssignFromStack_uv_3);

            app.RegisterCLRMemberwiseClone(type, PerformMemberwiseClone);

            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Data.SpriteInfo());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Data.SpriteInfo[s]);


        }

        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref huqiang.Data.SpriteInfo instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch(ptr_of_this_method->ObjectType)
            {
                case ObjectTypes.Object:
                    {
                        __mStack[ptr_of_this_method->Value] = instance_of_this_method;
                    }
                    break;
                case ObjectTypes.FieldReference:
                    {
                        var ___obj = __mStack[ptr_of_this_method->Value];
                        if(___obj is ILTypeInstance)
                        {
                            ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            var t = __domain.GetType(___obj.GetType()) as CLRType;
                            t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                        }
                    }
                    break;
                case ObjectTypes.StaticFieldReference:
                    {
                        var t = __domain.GetType(ptr_of_this_method->Value);
                        if(t is ILType)
                        {
                            ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                        }
                        else
                        {
                            ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                        }
                    }
                    break;
                 case ObjectTypes.ArrayReference:
                    {
                        var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as huqiang.Data.SpriteInfo[];
                        instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
                    }
                    break;
            }
        }


        static object get_Name_0(ref object o)
        {
            return ((huqiang.Data.SpriteInfo)o).Name;
        }

        static StackObject* CopyToStack_Name_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.SpriteInfo)o).Name;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_Name_0(ref object o, object v)
        {
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.Name = (System.String)v;
            o = ins;
        }

        static StackObject* AssignFromStack_Name_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @Name = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.Name = @Name;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_rect_1(ref object o)
        {
            return ((huqiang.Data.SpriteInfo)o).rect;
        }

        static StackObject* CopyToStack_rect_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.SpriteInfo)o).rect;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_rect_1(ref object o, object v)
        {
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.rect = (UnityEngine.Rect)v;
            o = ins;
        }

        static StackObject* AssignFromStack_rect_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Rect @rect = (UnityEngine.Rect)typeof(UnityEngine.Rect).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.rect = @rect;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_pivot_2(ref object o)
        {
            return ((huqiang.Data.SpriteInfo)o).pivot;
        }

        static StackObject* CopyToStack_pivot_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.SpriteInfo)o).pivot;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_pivot_2(ref object o, object v)
        {
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.pivot = (UnityEngine.Vector2)v;
            o = ins;
        }

        static StackObject* AssignFromStack_pivot_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector2 @pivot = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.pivot = @pivot;
            o = ins;
            return ptr_of_this_method;
        }

        static object get_uv_3(ref object o)
        {
            return ((huqiang.Data.SpriteInfo)o).uv;
        }

        static StackObject* CopyToStack_uv_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.SpriteInfo)o).uv;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_uv_3(ref object o, object v)
        {
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.uv = (UnityEngine.Vector2[])v;
            o = ins;
        }

        static StackObject* AssignFromStack_uv_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector2[] @uv = (UnityEngine.Vector2[])typeof(UnityEngine.Vector2[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            huqiang.Data.SpriteInfo ins =(huqiang.Data.SpriteInfo)o;
            ins.uv = @uv;
            o = ins;
            return ptr_of_this_method;
        }


        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new huqiang.Data.SpriteInfo();
            ins = (huqiang.Data.SpriteInfo)o;
            return ins;
        }


    }
}
